// EDVector3d.cpp: implementation of the EDVector3d class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "EDVector3d.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

const EDVector3d EDVector3d::kIdentity;

EDVector3d::EDVector3d()
{
}

EDVector3d::~EDVector3d()
{
}

EDVector3d::EDVector3d (
	const EDSQLExpression& exp0,
	const EDSQLExpression& exp1,
	const EDSQLExpression& exp2 )
	: x ( exp0 ), y ( exp1 ), z ( exp2 )
{
}

EDVector3d::EDVector3d (
	const CString& str0,
	const CString& str1,
	const CString& str2 )
	: x ( str0 ), y ( str1 ), z ( str2 )
{
}

EDVector3d& EDVector3d::operator = ( const EDVector3d& v )
{
	x = v.x;
	y = v.y;
	z = v.z;
	return *this;
}

EDVector3d& EDVector3d::operator = ( const AcGeVector3d& v )
{
	x.m_strExpression.Format ( _T ( "%f" ), v.x );
	y.m_strExpression.Format ( _T ( "%f" ), v.y );
	z.m_strExpression.Format ( _T ( "%f" ), v.z );
	return *this;
}

void EDVector3d::Replace ( const CVarArray* pVarAr, const int nStart )
{
	EDSQLExpression::Replace ( &x, pVarAr, nStart );
	EDSQLExpression::Replace ( &y, pVarAr, nStart );
	EDSQLExpression::Replace ( &z, pVarAr, nStart );
}

BOOL EDVector3d::IsSingleDigital()
{
	if ( !EDSQLExpression::IsSingleDigitalVar ( &x ) )
		return FALSE;
	if ( !EDSQLExpression::IsSingleDigitalVar ( &y ) )
		return FALSE;
	if ( !EDSQLExpression::IsSingleDigitalVar ( &z ) )
		return FALSE;

	return TRUE;
}

void EDVector3d::Set (
	const EDSQLExpression& exp0,
	const EDSQLExpression& exp1,
	const EDSQLExpression& exp2 )
{
	x = exp0;
	y = exp1;
	z = exp2;
}

void EDVector3d::Set (
	const CString& str0,
	const CString& str1,
	const CString& str2 )
{
	x.m_strExpression = str0;
	y.m_strExpression = str1;
	z.m_strExpression = str2;
}
